import * as api from "../until/login"
import * as api1 from "../until/manager"



export default{
	namespace:"info",
	state:{
		name:"xiaoming",
		token:'',
		list:[]
	},
	reducers:{
		change(state,{payload}){
			return {...state,...payload}
		}
	},
	effects:{
		*getData(payload,{call,put}){
			const result=yield call(api.login,{userName:"admin",password:"admin"})
			// console.log(result)
			yield put({
				type:"change",
				payload:{
					token:result.data.token
				}
			})
		},
		*getManager(payload,{call,put}){
			const res=yield call(api1.manager,payload.payload)
			console.log(res)
			yield put({
				type:"change",
				payload:{
					list:res.data.data
				}
			})
		}
	}
}